#include "Camera.h"


Camera::Camera(vec4 _pos, int _w, int _h, int _d, float _fov){
	pos = _pos;
	scW = _w;
	scH = _h;
	scD = _d;
	
	aspct[0] = 1;						//aspct[0]: 1
	aspct[1] = (float)scW / (float)scH;	//aspct[1]: width / height
	aspct[2] = (float)scW / (float)scD;	//aspct[2]: width / depth
	fov = _fov;
	//calculate the vertical field of view
	vertical_fov = fov * (1.0f / aspct[1]);
	depth_fov = fov * (1.0f / aspct[2]);

	targetVec = vec4(0, 0, 1, 0);
	upVec = vec4(0, 1, 0, 0);
}


Camera::~Camera(){
}

void Camera::lookAt(vec4 _from, vec4 _at, vec4 _up){
	//create a viewing matrix
	pos = _from;
	targetVec = _at;
	upVec = _up;
}

//translates the camera's position by the xyz values in the value
void Camera::translate(vec4 _trans){
	pos += _trans;
	updateMatrix();
}


void Camera::scWidth(int _w){
	scW = _w;
	//aspct = (float)scW / (float)scH;
	//vertical_fov = fov * (1.0f / aspct);
}

void Camera::scHeight(int _h){
	scH = _h;
	//aspct = (float)scW / (float)scH;
	//vertical_fov = fov * (1.0f / aspct);
}

void Camera::FoV(float _fov){
	fov = _fov;
	//vertical_fov = fov * (1.0f / aspct);
	//updateMatrix();
}

void Camera::aspect(vec3 _aspect){
	aspct = _aspect;
	//vertical_fov = fov * (1.0f / aspct);
	//updateMatrix();
}

void Camera::updateMatrix(){

}
